#!/usr/bin/env python
# encoding:UTF-8
# _*_ coding:utf-8 _*_

import oss2
import requests
import hashlib
import time
m2 = hashlib.md5()

auth = oss2.Auth('1F3XYCCvHS3yOHL0', 'N1Qk7qJ2znC7a5a63uQ8HTkvvZ63Vl')
bucket = oss2.Bucket(auth, 'oss-cn-hangzhou.aliyuncs.com', 'pickbook')

def upload2oos(url):
    m2.update(url)

    name = m2.hexdigest()+time.strftime("%Y%m%d%H%M%S",time.localtime(time.time()))+".jpg"
    input = requests.get(url)
    bucket.put_object(name, input)
    print name
    return name
#
# print  upload2oos("http://img.woyaogexing.com/touxiang/nv/20140212/9ac2117139f1ecd8%21200x200.jpg")
# print time.strftime("%Y%m%d%H%M%S",time.localtime(time.time()))

